<template>
  <List :list="list" :total="total" :page-info="pageInfo" @page-change="handlePageChange" />
</template>
<script setup>
import { ref, onMounted } from 'vue'
import List from './order-list.vue'
import { getOrderList } from '@/api/order'
const list = ref([])
const total = ref(0)
const pageInfo = {
  current: 1,
  pageSize: 10
}

const handlePageChange = (page) => {
  fetchData({
    current: page,
    pageSize: pageInfo.pageSize
  })
}
const fetchData = (pageInfo = { current: 1, pageSize: 10 }) => {
  getOrderList({
    page: pageInfo.current,
    pageSize: pageInfo.pageSize
    //   Keyword: pageInfo.keyword,
  })
    .then((data) => {
      list.value = data.list
      total.value = data.total
    })
    .finally(() => {
      // setLoading(false);
    })
}
onMounted(() => {
  fetchData()
})
</script>
<style lang="less" scoped></style>
